/*
 * customerTab.java
 *
 * Created on 12 novembre 2008, 10:12
 */

package GUI;

import java.awt.Point;
import java.awt.event.KeyEvent;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author  coco
 */
 class CustomEditableCellTableModel extends DefaultTableModel {

        private ArrayList listCellNotEditable;

        public CustomEditableCellTableModel() {
            super();
            this.listCellNotEditable = new ArrayList();
        }

        public CustomEditableCellTableModel(int numRows, int numColumns) {
            super(numRows, numColumns);
            this.listCellNotEditable = new ArrayList();
        }

        public CustomEditableCellTableModel(Vector columnNames, int numRows) {
            super(columnNames, numRows);
            this.listCellNotEditable = new ArrayList();
        }

        public CustomEditableCellTableModel(Object[] columnNames, int numRows) {
            super(columnNames, numRows);
            this.listCellNotEditable = new ArrayList();
        }

        public CustomEditableCellTableModel(Vector data, Vector columnNames) {
            super(data, columnNames);
            this.listCellNotEditable = new ArrayList();
        }

        public CustomEditableCellTableModel(Object[][] data, Object[] columnNames) {
            super(data, columnNames);
            this.listCellNotEditable = new ArrayList();
        }

        public void addNotEditableCell(int row, int column) {
            if ( ! (column >= 0 && column < this.getColumnCount()) ) {
                return;
            }
            if ( ! ((row >= 0) && (row < this.getRowCount())) ) {
                return;
            }
            this.listCellNotEditable.add(new Point(row, column));
        }

        public void removeNotEditableCell(int row, int column) {
            int index = this.listCellNotEditable.indexOf(new Point(row, column));
            if ( index != -1 ) {
                this.listCellNotEditable.remove(index);
            }
        }
       public boolean isCellEditable(int row, int column) {
            int index = this.listCellNotEditable.indexOf(new Point(row, column));
            if ( index == -1 ) {
                return ( false );
            } else {
                return ( true );
            }
        }
    }
public class customerTab extends javax.swing.JPanel {

    /** Creates new form customerTab */
    public customerTab() throws ParseException {
        initComponents();
        String données[][];
        données=kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID,1,"%%");

        //on affiche la jTable des utilisateurs'
        String[] nomsColonne={"Kundennummer","Anrede","Name","Vornamel","Geburtsdatum","Adresse","Telefon","Fs. Klassen","Fs. Datum","RabattFaktor"};
        CustomEditableCellTableModel jTable2 =new CustomEditableCellTableModel(données,nomsColonne) ;
        customerTable.setModel(jTable2);
        customerTable=centrerTable(customerTable);
        customerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        customerTable.setAutoCreateRowSorter(true);
    }
    public static JTable centrerTable(JTable table) {
        DefaultTableCellRenderer custom = new DefaultTableCellRenderer();//on crée un nouveau model de DefaultTableCellRenderer
        custom.setHorizontalAlignment(JLabel.CENTER); //dans celle ci on centre les header
        
        //on centre pour chaque cellule
        for (int i=0 ; i<table.getColumnCount() ; i++)
            table.getColumnModel().getColumn(i).setCellRenderer(custom);
        return table;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        customerTab = new javax.swing.JPanel();
        customerTableScrollPane = new javax.swing.JScrollPane();
        customerTable = new javax.swing.JTable();
        customerNameSearchField = new javax.swing.JTextField();
        customerNameLabel = new javax.swing.JLabel();
        customerIdLabel = new javax.swing.JLabel();
        currentData = new GUI.currentDataFrame();
        customerSearchButton = new javax.swing.JButton();
        customerSelectButton = new javax.swing.JButton();
        customerAddButton = new javax.swing.JButton();
        customerIdSearchField = new javax.swing.JFormattedTextField();

        customerTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Kundennummer", "Anrede", "Name", "Vorname", "Geburtsdatum", "Adresse", "Telefon", "Fs. Klassen", "Fs. Datum"
            }
        ));
        customerTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                customerTableMouseClicked(evt);
            }
        });
        customerTableScrollPane.setViewportView(customerTable);
        customerTable.getColumnModel().getColumn(0).setPreferredWidth(15);
        customerTable.getColumnModel().getColumn(1).setPreferredWidth(30);
        customerTable.getColumnModel().getColumn(6).setPreferredWidth(40);
        customerTable.getColumnModel().getColumn(7).setPreferredWidth(30);
        customerTable.getColumnModel().getColumn(8).setPreferredWidth(30);

        customerNameSearchField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                customerNameSearchFieldActionPerformed(evt);
            }
        });
        customerNameSearchField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                customerNameSearchFieldKeyPressed(evt);
            }
        });

        customerNameLabel.setText("Name");

        customerIdLabel.setText("Kundennummer");

        customerSearchButton.setText("Suchen");
        customerSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                customerSearchButtonActionPerformed(evt);
            }
        });
        customerSearchButton.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                customerSearchButtonKeyPressed(evt);
            }
        });

        customerSelectButton.setText("Auswählen");
        customerSelectButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                customerSelectButtonActionPerformed(evt);
            }
        });

        customerAddButton.setText("Hinzufügen");
        customerAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                customerAddButtonActionPerformed(evt);
            }
        });

        customerIdSearchField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
        customerIdSearchField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                customerIdSearchFieldKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                customerIdSearchFieldKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout customerTabLayout = new javax.swing.GroupLayout(customerTab);
        customerTab.setLayout(customerTabLayout);
        customerTabLayout.setHorizontalGroup(
            customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(customerTabLayout.createSequentialGroup()
                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(customerTabLayout.createSequentialGroup()
                        .addGap(417, 417, 417)
                        .addComponent(customerNameLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(customerNameSearchField, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(customerIdLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(customerIdSearchField, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(customerSearchButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 548, Short.MAX_VALUE)
                        .addComponent(customerAddButton))
                    .addGroup(customerTabLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(customerTableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1506, Short.MAX_VALUE)))
                .addContainerGap())
            .addComponent(currentData, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1530, Short.MAX_VALUE)
            .addGroup(customerTabLayout.createSequentialGroup()
                .addGap(521, 521, 521)
                .addComponent(customerSelectButton, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(833, Short.MAX_VALUE))
        );
        customerTabLayout.setVerticalGroup(
            customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(customerTabLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(customerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(customerNameSearchField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(customerNameLabel)
                    .addComponent(customerIdLabel)
                    .addComponent(customerSearchButton)
                    .addComponent(customerAddButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(customerIdSearchField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(customerTableScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(customerSelectButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 130, Short.MAX_VALUE)
                .addComponent(currentData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1530, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 0, 0)
                    .addComponent(customerTab, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGap(0, 0, 0)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 570, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 0, 0)
                    .addComponent(customerTab, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGap(0, 0, 0)))
        );
    }// </editor-fold>//GEN-END:initComponents

private void customerTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_customerTableMouseClicked
System.out.println("toi");
        if(evt.getClickCount()>1){
            this.setEnabled(false);
            customerChange customerFrame=new customerChange();
            customerFrame.setSize(600,350);
            customerFrame.setLocationRelativeTo(null);
            String données[][] = null;
            int Rowselect=customerTable.getSelectedRow();
            Object id=customerTable.getValueAt(Rowselect,0);
            int toto=Integer.parseInt(id.toString());
            System.out.println("jesuisici"+toto);
            try {
                données = kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID, Integer.parseInt(id.toString()), "tqsdsqd");
            } catch (ParseException ex) {
                Logger.getLogger(customerTab.class.getName()).log(Level.SEVERE, null, ex);
            }
           customerChange.addupdate=2;
           customerFrame.setTitle("ändert eine Kunde");
           customerFrame.customerChangeIdLabel.setVisible(true);
           customerFrame.customerChangeIdInfo.setVisible(true);
           customerFrame.customerChangeIdInfo.setText(données[0][0]);
           customerFrame.customerChangeRegisterDateInfo.setText("");
           customerFrame.customerChangeAddressField.setText(données[0][5]);
           customerFrame.customerChangeAnredeField.setSelectedItem(données[0][1]);
           customerFrame.customerChangeBirthField.setText(données[0][4]);
           customerFrame.customerChangeDiscountFactorField.setVisible(true);
           customerFrame.customerChangeDiscountFactorLabel.setVisible(true);
           customerFrame.customerChangeDiscountFactorField.setText(données[0][9]);
           customerFrame.customerChangeFirstnameField.setText(données[0][2]);
           customerFrame.customerChangeLicenseClassField.setText(données[0][7]);
           customerFrame.customerChangeLicenseDateField.setText(données[0][8]);
           customerFrame.customerChangeSurnameField.setText(données[0][3]);
           customerFrame.customerChangeTelefonField.setText(données[0][6]);
           customerFrame.customerChangeCompanyField.setText(données[0][11]);
           customerFrame.customerChangeausweisnummerField.setText(données[0][10]);
            customerFrame.setVisible(true);
        }
// TODO add your handling code here:
}//GEN-LAST:event_customerTableMouseClicked

private void customerSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customerSearchButtonActionPerformed

        String données[][] = null;
        int kundennumer;
        if(customerIdSearchField.getText().equals("")){
            kundennumer=0;
        }
        else
        kundennumer=Integer.parseInt(customerIdSearchField.getText());
        try {
            données = kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID, kundennumer, customerNameSearchField.getText());
        } catch (ParseException ex) {
            Logger.getLogger(customerTab.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        //on affiche la jTable des utilisateurs'
        String[] nomsColonne={"Kundennummer","Anrede","Name","Vornamel","Geburtsdatum","Adresse","Telefon","Fs. Klassen","Fs. Datum","RabattFaktor"};
        CustomEditableCellTableModel jTable2 =new CustomEditableCellTableModel(données,nomsColonne) ;
        customerTable.setModel(jTable2);
        customerTable=centrerTable(customerTable);
        customerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        customerTable.setAutoCreateRowSorter(true); 
}//GEN-LAST:event_customerSearchButtonActionPerformed

private void customerSelectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customerSelectButtonActionPerformed
// TODO add your handling code here:
    GraphicalUserInterface.selectedCustomer.setID(Integer.parseInt((String)customerTable.getValueAt(customerTable.getSelectedRow(), 0)));
    GraphicalUserInterface.selectedCustomer.setAnrede((String)customerTable.getValueAt(customerTable.getSelectedRow(), 1));
    GraphicalUserInterface.selectedCustomer.setName((String)customerTable.getValueAt(customerTable.getSelectedRow(), 2));
    GraphicalUserInterface.selectedCustomer.setVorname((String)customerTable.getValueAt(customerTable.getSelectedRow(), 3));
    GraphicalUserInterface.selectedCustomer.setGeburtsdatum((String)customerTable.getValueAt(customerTable.getSelectedRow(), 4));
    GraphicalUserInterface.selectedCustomer.setAdresse((String)customerTable.getValueAt(customerTable.getSelectedRow(), 5));
    GraphicalUserInterface.selectedCustomer.setTelefonnummer((String)customerTable.getValueAt(customerTable.getSelectedRow(), 6));
    GraphicalUserInterface.selectedCustomer.setFuehrerscheinklassen((String)customerTable.getValueAt(customerTable.getSelectedRow(), 7));
    GraphicalUserInterface.selectedCustomer.setFuehrerscheindatum((String)customerTable.getValueAt(customerTable.getSelectedRow(), 8));
    //PROBLEM HERE! I dont have the Rebatt!
    GraphicalUserInterface.selectedCustomer.setRebatt(Float.parseFloat((String)customerTable.getValueAt(customerTable.getSelectedRow(), 9)));
    //PROBLEM HERE! I dont have the Firma!
    GraphicalUserInterface.selectedCustomer.setFirmennamen("");
    currentData.updateCustomer();
    if(GraphicalUserInterface.selectedCar.size()>0) GraphicalUserInterface.enableRentalTab();
}//GEN-LAST:event_customerSelectButtonActionPerformed

private void customerAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customerAddButtonActionPerformed

           customerChange Framecustomer=new customerChange();
           customerChange.addupdate=1;
           Framecustomer.setTitle("Hinzufügen einen Kunde");
           Framecustomer.customerChangeIdLabel.setVisible(false);
           Framecustomer.customerChangeIdInfo.setVisible(false);
           String Datum=new Date().toString();
           String year=Datum.substring(8,10);
           String FinalDatum=Datum.substring(0,8);
           Framecustomer.customerChangeRegisterDateInfo.setText(FinalDatum+year);
           Framecustomer.customerChangeAddressField.setText("");
           Framecustomer.customerChangeAnredeField.setSelectedItem(0);
           Framecustomer.customerChangeBirthField.setText("");
           Framecustomer.customerChangeDiscountFactorField.setVisible(false);
           Framecustomer.customerChangeDiscountFactorLabel.setVisible(false);
           Framecustomer.customerChangeFirstnameField.setText("");
           Framecustomer.customerChangeLicenseClassField.setText("");
           Framecustomer.customerChangeLicenseDateField.setText("");
           Framecustomer.customerChangeSurnameField.setText("");
           Framecustomer.customerChangeTelefonField.setText("");
           Framecustomer.customerChangeCompanyField.setText("");
           Framecustomer.customerChangeausweisnummerField.setText("");


            Framecustomer.setSize(620,350);
            Framecustomer.setLocationRelativeTo(null);
            Framecustomer.setVisible(true);
}//GEN-LAST:event_customerAddButtonActionPerformed

private void customerNameSearchFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_customerNameSearchFieldKeyPressed
    if (evt.getKeyCode()==KeyEvent.VK_ENTER){
     String données[][] = null;
        int kundennumer;
        if(customerIdSearchField.getText().equals("")){
            kundennumer=0;
        }
        else
        kundennumer=Integer.parseInt(customerIdSearchField.getText());
        try {
            données = kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID, kundennumer, customerNameSearchField.getText());
        } catch (ParseException ex) {
            Logger.getLogger(customerTab.class.getName()).log(Level.SEVERE, null, ex);
        }

        //on affiche la jTable des utilisateurs'
        String[] nomsColonne={"Kundennummer","Anrede","Name","Vornamel","Geburtsdatum","Adresse","Telefon","Fs. Klassen","Fs. Datum","RabattFaktor"};
        CustomEditableCellTableModel jTable2 =new CustomEditableCellTableModel(données,nomsColonne) ;
        customerTable.setModel(jTable2);
        customerTable=centrerTable(customerTable);
        customerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        customerTable.setAutoCreateRowSorter(true);


    }
}//GEN-LAST:event_customerNameSearchFieldKeyPressed

private void customerNameSearchFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customerNameSearchFieldActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_customerNameSearchFieldActionPerformed

private void customerIdSearchFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_customerIdSearchFieldKeyReleased
    // TODO add your handling code here:
}//GEN-LAST:event_customerIdSearchFieldKeyReleased

private void customerIdSearchFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_customerIdSearchFieldKeyPressed
    if (evt.getKeyCode()==KeyEvent.VK_ENTER){
     String données[][] = null;
        int kundennumer;
        if(customerIdSearchField.getText().equals("")){
            kundennumer=0;
        }
        else
        kundennumer=Integer.parseInt(customerIdSearchField.getText());
        try {
            données = kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID, kundennumer, customerNameSearchField.getText());
        } catch (ParseException ex) {
            Logger.getLogger(customerTab.class.getName()).log(Level.SEVERE, null, ex);
        }

        //on affiche la jTable des utilisateurs'
        String[] nomsColonne={"Kundennummer","Anrede","Name","Vornamel","Geburtsdatum","Adresse","Telefon","Fs. Klassen","Fs. Datum","RabattFaktor"};
        CustomEditableCellTableModel jTable2 =new CustomEditableCellTableModel(données,nomsColonne) ;
        customerTable.setModel(jTable2);
        customerTable=centrerTable(customerTable);
        customerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        customerTable.setAutoCreateRowSorter(true);


    }
}//GEN-LAST:event_customerIdSearchFieldKeyPressed

private void customerSearchButtonKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_customerSearchButtonKeyPressed
    if (evt.getKeyCode()==KeyEvent.VK_ENTER){
     String données[][] = null;
        int kundennumer;
        if(customerIdSearchField.getText().equals("")){
            kundennumer=0;
        }
        else
        kundennumer=Integer.parseInt(customerIdSearchField.getText());
        try {
            données = kernel.Customer.searchcustomer(GUI.LoginWindow.sessionID, kundennumer, customerNameSearchField.getText());
        } catch (ParseException ex) {
            Logger.getLogger(customerTab.class.getName()).log(Level.SEVERE, null, ex);
        }

        //on affiche la jTable des utilisateurs'
        String[] nomsColonne={"Kundennummer","Anrede","Name","Vornamel","Geburtsdatum","Adresse","Telefon","Fs. Klassen","Fs. Datum","RabattFaktor"};
        CustomEditableCellTableModel jTable2 =new CustomEditableCellTableModel(données,nomsColonne) ;
        customerTable.setModel(jTable2);
        customerTable=centrerTable(customerTable);
        customerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        customerTable.setAutoCreateRowSorter(true);


    }
}//GEN-LAST:event_customerSearchButtonKeyPressed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static GUI.currentDataFrame currentData;
    private javax.swing.JButton customerAddButton;
    private javax.swing.JLabel customerIdLabel;
    private javax.swing.JFormattedTextField customerIdSearchField;
    private javax.swing.JLabel customerNameLabel;
    private javax.swing.JTextField customerNameSearchField;
    private javax.swing.JButton customerSearchButton;
    private javax.swing.JButton customerSelectButton;
    private javax.swing.JPanel customerTab;
    public static javax.swing.JTable customerTable;
    private javax.swing.JScrollPane customerTableScrollPane;
    // End of variables declaration//GEN-END:variables

}
